package com.csw.pojo;

import com.csw.util.LayerUtil;
import com.csw.util.MapUtil;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author A
 * @version 1.0
 * @description: TODO
 * @date 2022/12/1 0:07
 */
@Data
public class Map {

    private Integer height;
    private List<Layer> layerList =new ArrayList<Layer>();

    public void compareAll(){
        for (int i = 1; i < layerList.size(); i++) {
            Layer layer= layerList.get(i);
            Cell[][] cells = layer.getCells();
            for (int j = 0; j < cells.length; j++) {
                for (int k = 0; k < cells[j].length; k++) {
                    Cell cell = cells[j][k];
                    //该单元格有牌
                    if (cell.getState()==1){
                        Brand brand = cell.getBrand();

                        Boolean compare = MapUtil.compare(brand, layer.getNextLayer());
                        brand.setGray(compare);
                    }

                }
            }

        }
    }
}
